<include file="public@header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('goods/index')}">商品</a></li>
        <li class="active"><a href="{:url('goods/add')}">商品修改</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('goods/editPost')}">
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">商品名称<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="name" value="{$list.name}">
            </div>
        </div>

<div class="form-group">
    <label for="input-image" class="col-sm-2 control-label">封面图片<span class="form-required">*</span></label>
    <div class="col-md-6 col-sm-10">
        <input id="photo-1" type="hidden" name="image" value="{$list.image}" >
        <input id="photo-1-name" type="text" name="image" value="{$list.image}" title="图片名称" class="form-control" readonly disabled>
    </div>
</div>
<div class="form-group">
    <label for="input-image" class="col-sm-2 control-label"></label>
    <div class="col-md-6 col-sm-10">
        <img id="photo-1-preview" style="width: 100px;"  src="/upload/{$list.image}">
        <div>
            <a href="javascript:uploadOneImage('图片上传','#photo-1');" class="btn btn-primary">上传</a>
        </div>
    </div>
</div>

        <div class="form-group">
            <label for="input-images" class="col-sm-2 contro1-1abel">图集</label><div class="col-md-6 co1-sm-10">
            <div id="imagesContainer"></div>
            <foreach name="$list['images']" item="v">
                <img src="/upload/{$v}" style="width: 40px">
            </foreach>
            <div class="margin-top- 10">
                <a class="btn btn-default" href="javascript:uploadMultiImage('图片上传', '#imagesContainer', 'photos-item-wrapper ');">选择图片</a>
            </div>
        </div>
        </div>
<div class="form-group">
    <label for="input-freight" class="col-sm-2 control-label">运费<span class="form-required">*</span></label>
    <div class="col-md-6 col-sm-10">
        <input type="text" class="form-control" id="input-freight" name="freight" value="{$list.freight}">
    </div>
</div>

<div class="form-group">
    <label for="input-sort_id" class="col-sm-2 control-label">分类<span class="form-required">*</span></label>
    <div class="col-md-6 col-sm-10">
        <input type="text" class="form-control" id="input-sort_id" name="sort_id" value="{$list.sort_id}">
    </div>
</div>
        <div class="form-group">
            <label for="" class="col-sm-2 control-label">状态<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="radio" id="option1" name="type" value="0">
                <label for="option1">无货</label><br>
                <input type="radio" id="option2" name="type" value="1">
                <label for="option2">正常</label><br>
                <input type="radio" id="option3" name="type" value="2">
                <label for="option3">下架</label><br>
            </div>
        </div>
        <div class="form-group">
            <label for="" class="col-sm-2 control-label">是否自营<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="radio" id="op1" name="status" value="0">
                <label for="op1">是</label><br>
                <input type="radio" id="op2" name="status" value="1">
                <label for="op2">否</label><br>

            </div>
        </div>


        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <input type="hidden" name="id" value="{$list.id}">
                <button type="submit" class="btn btn-primary js-ajax-submit">修改</button>
                <a class="btn btn-default" href="javascript:history.back(-1);">返回</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
<script type="text/html" id="photos-item-wrapper">
    <div style="display: flex;align-items:center;border:1px solid #ddd;padding: 5px;margin-top:10px;  ">
        <div><img id="photo-{id}-preview" src="{url}" class="img-thumbnail" style="width: 100px;height: 50px;"></div>
        <div style="margin-left:10px; ">{name}</div>
        <input type="hidden" id="photo-{id}" name="images[]" value="{filepath}">
    </div>
</script>
</body>
</body>
</html>